/*
 * Copyright (c) 2012-2020 MIRACL UK Ltd.
 *
 * This file is part of MIRACL Core
 * (see https://github.com/miracl/core).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// To run test program 
// g++ -O2 parsex509.cpp  core.a -o parsex509

#include <stdio.h>
#include "core.h"  // for octet support only
#include "x509.h"

//X.509 certificate to be parsed
char cert_b64[] = 
//"MIIEqTCCBE6gAwIBAgIQCUho6vi3wBtbszzmPTzoETAKBggqhkjOPQQDAjBKMQswCQYDVQQGEwJVUzEZMBcGA1UEChMQQ2xvdWRmbGFyZSwgSW5jLjEgMB4GA1UEAxMXQ2xvdWRmbGFyZSBJbmMgRUNDIENBLTMwHhcNMjAwNzA0MDAwMDAwWhcNMjEwNzA0MTIwMDAwWjBmMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28xGTAXBgNVBAoTEENsb3VkZmxhcmUsIEluYy4xFzAVBgNVBAMTDnJlYWxweXRob24uY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEAXgIjQtoJAzulMsFjqvvsH3jcW+pew7e/GZQ3aaN5ZoSW2tRygJrjZvkxOKsrd9Fx7fMeQyVywdGyN806TGH4aOCAvgwggL0MB8GA1UdIwQYMBaAFKXON+rrsHUOlGeItEX62SQQh5YfMB0GA1UdDgQWBBTfMP4k+FTKlvFKQVBD803CQZqNwzArBgNVHREEJDAigg5yZWFscHl0aG9uLmNvbYIQKi5yZWFscHl0aG9uLmNvbTAOBgNVHQ8BAf8EBAMCB4AwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFB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7ku9t3XOYLrhQmkfq+GeZqMPfl+wctiDAMR7iXqo/csAAAFw7RyoWQAABAMARzBFAiBLaFINqBs0gCp5iJJmFK4SZLEh5odSqQzM5qcGioahkgIhAN1pLoldqz8HiTE3AfbdYPpG93PaH9/vUXA29NBJ40vXAHcAh3W/51l8+IxDmV+9827/Vo1HVjb/SrVgwbTq/16ggw8AAAFw7RyofgAABAMASDBGAiEAsSsYnAmABawf6d4I5URZ0XDGdOZzWBzwtX9H4EFXx08CIQCSBKE12BsPRYQpEbYxQ64Un9Ux9S7Obq7wxmEFCAREWDAKBggqhkjOPQQDAwNoADBlAjBkOXvqzVKGGao/jeOiJuJKb2ucN1s4HAcmegBxvkgzFBJzSa0HmIfeI7457v89b0cCMQCVCJcNQMs8vNr5aKbcso6Esgyn+aNPMHuOcf0lTJnBO/20vuGuIJ7eIdCiFPH0vpM=";

char io[5000];
octet IO = {0, sizeof(io), io};

#define MAXMODBYTES 72
#define MAXFFLEN 16

char sig[MAXMODBYTES * MAXFFLEN];
octet SIG = {0, sizeof(sig), sig};

char r[MAXMODBYTES];
octet R = {0, sizeof(r), r};

char s[MAXMODBYTES];
octet S = {0, sizeof(s), s};

char cakey[MAXMODBYTES * MAXFFLEN];
octet CAKEY = {0, sizeof(cakey), cakey};

char certkey[MAXMODBYTES * MAXFFLEN];
octet CERTKEY = {0, sizeof(certkey), certkey};

char h[5000];
octet H = {0, sizeof(h), h};

char hh[5000];
octet HH = {0, sizeof(hh), hh};


static void print_out(char *des, octet *c, int index, int len)
{
    int i;
    printf("%s [", des);
    for (i = 0; i < len; i++)
        printf("%c", c->val[index + i]);
    printf("]\n");
}

static void print_raw(char *des, octet *c, int index, int len)
{
    int i;
    printf("%s [", des);
    for (i = 0; i < len; i++)
        printf("%02x ", (unsigned char)c->val[index + i]);
    printf("]\n");
}

static void print_date(char *des, octet *c, int index)
{
    int i = index;
    printf("%s [", des);
    if (i == 0) printf("]\n");
    else printf("20%c%c-%c%c-%c%c %c%c:%c%c:%c%c]\n", c->val[i], c->val[i + 1], c->val[i + 2], c->val[i + 3], c->val[i + 4], c->val[i + 5], c->val[i + 6], c->val[i + 7], c->val[i + 8], c->val[i + 9], c->val[i + 10], c->val[i + 11]);
}

int main()
{
    int res, len, sha;
    int c, ic;
    pktype st, ca, pt;

    OCT_frombase64(&IO, cert_b64);
    printf("Certificate= \n");
    OCT_output(&IO);
    printf("\n");

    st = X509_extract_cert_sig(&IO, &SIG); // returns signature type

    if (st.type == 0)
    {
        printf("Unable to extract cert signature\n");
        return 0;
    }

    if (st.type == X509_ECC)
    {
        OCT_chop(&SIG, &S, SIG.len / 2);
        OCT_copy(&R, &SIG);
        printf("ECC SIG= \n");
        OCT_output(&R);
        OCT_output(&S);
        printf("\n");
    }

    if (st.type == X509_RSA)
    {
        printf("RSA SIG= \n");
        OCT_output(&SIG);
        printf("\n");
    }

    if (st.hash == X509_H256) printf("Hashed with SHA256\n");
    if (st.hash == X509_H384) printf("Hashed with SHA384\n");
    if (st.hash == X509_H512) printf("Hashed with SHA512\n");

// Extract Cert from signed Cert

    c = X509_extract_cert(&IO, &H);

    printf("\nCert= \n");
    OCT_output(&H);
    printf("\n");

// show some details
    printf("Issuer Details\n");
    ic = X509_find_issuer(&H);
    c = X509_find_entity_property(&H, &X509_ON, ic, &len);
    print_out((char *)"owner=", &H, c, len);
    c = X509_find_entity_property(&H, &X509_CN, ic, &len);
    print_out((char *)"country=", &H, c, len);
    c = X509_find_entity_property(&H, &X509_EN, ic, &len);
    print_out((char *)"email=", &H, c, len);
    c = X509_find_entity_property(&H, &X509_MN, ic, &len);
    print_out((char *)"Common name=", &H, c, len);
    printf("\n");

    printf("Extensions\n");
    ic=X509_find_extensions(&H);
    c=X509_find_extension(&H,&X509_KU,ic,&len);
    if (c!=0)
       print_raw((char *)"key usage extension=", &H, c, len);
    c=X509_find_extension(&H,&X509_AN,ic,&len);

    if (X509_find_alt_name(&H,c,(char *)"michael.realpython.com"))
        printf("Found Website\n");
    else
        printf("Failed to find Website\n");

exit(0);
    ca = X509_extract_public_key(&H, &CAKEY);

    if (ca.type == 0)
    {
        printf("Not supported by library\n");
        return 0;
    }
    //if (ca.type != st.type)
    if (!X509_self_signed(&H))
    {
        printf("Not self-signed\n");
    }

    if (ca.type == X509_ECC)
    {
        printf("EXTRACTED ECC PUBLIC KEY= \n");
        OCT_output(&CAKEY);
    }
    if (ca.type == X509_RSA)
    {
        printf("EXTRACTED RSA PUBLIC KEY= \n");
        OCT_output(&CAKEY);
    }
    printf("\n");

    return 0;
}
